package com.cai.quartz.trigger;

import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;

@Slf4j
public class MyTrigger implements Job {
    @Override
    public void execute(JobExecutionContext context) {
        log.info("执行【服务任务】");
        //获取JobKey、startTime、endTime
        Trigger trigger = context.getTrigger();
        log.info("jobKey名称: {},jobKey组名称: {}",trigger.getJobKey().getName(),trigger.getJobKey().getGroup());
        log.info("任务开始时间：{}",trigger.getStartTime());
        log.info("任务结束时间：{}",trigger.getEndTime());
    }
}
